/*  1:   */ package org.intellij.lang.regexp.psi.impl;
/*  2:   */ 
/*  3:   */

import com.intellij.extapi.psi.ASTWrapperPsiElement;
import com.intellij.lang.ASTNode;
import com.intellij.lang.Language;
import com.intellij.lang.LanguageParserDefinitions;
import com.intellij.lang.ParserDefinition;
import com.intellij.lang.injection.InjectedLanguageManager;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
import com.intellij.psi.tree.IElementType;
import com.intellij.util.IncorrectOperationException;
import org.intellij.lang.regexp.RegExpLanguage;
import org.intellij.lang.regexp.psi.RegExpElement;
import org.intellij.lang.regexp.psi.RegExpElementVisitor;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/*  4:   */
/*  5:   */
/*  6:   */
/*  7:   */
/*  8:   */
/*  9:   */
/* 10:   */
/* 11:   */
/* 12:   */
/* 13:   */
/* 14:   */
/* 15:   */
/* 16:   */
/* 17:   */
/* 18:   */
/* 19:   */
/* 20:   */ 
/* 21:   */ public abstract class RegExpElementImpl
/* 22:   */   extends ASTWrapperPsiElement
/* 23:   */   implements RegExpElement
/* 24:   */ {
/* 25:   */   public RegExpElementImpl(ASTNode paramASTNode)
/* 26:   */   {
/* 27:37 */     super(paramASTNode);
/* 28:   */   }
/* 29:   */   
/* 30:   */   @NotNull
/* 31:   */   public Language getLanguage()
/* 32:   */   {
/* 33:42 */     RegExpLanguage tmp3_0 = RegExpLanguage.INSTANCE;
/* 34:42 */     if (tmp3_0 == null) {
/* 35:42 */       throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "org/intellij/lang/regexp/psi/impl/RegExpElementImpl", "getLanguage" }));
/* 36:   */     }
/* 37:42 */     return tmp3_0;
/* 38:   */   }
/* 39:   */   
/* 40:   */   @NotNull
/* 41:   */   public ASTNode getNode()
/* 42:   */   {
/* 43:48 */     ASTNode tmp4_1 = super.getNode();
/* 44:48 */     if (tmp4_1 == null) {
/* 45:48 */       throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "org/intellij/lang/regexp/psi/impl/RegExpElementImpl", "getNode" }));
/* 46:   */     }
/* 47:48 */     return tmp4_1;
/* 48:   */   }
/* 49:   */   
/* 50:   */   public String toString()
/* 51:   */   {
/* 52:52 */     return getClass().getSimpleName() + ": <" + getText() + ">";
/* 53:   */   }
/* 54:   */   
/* 55:   */   public void accept(@NotNull PsiElementVisitor paramPsiElementVisitor)
/* 56:   */   {
/* 57:56 */     if (paramPsiElementVisitor == null) {
/* 58:56 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/intellij/lang/regexp/psi/impl/RegExpElementImpl", "accept" }));
/* 59:   */     }
/* 60:56 */     if ((paramPsiElementVisitor instanceof RegExpElementVisitor)) {
/* 61:57 */       accept((RegExpElementVisitor)paramPsiElementVisitor);
/* 62:   */     } else {
/* 63:59 */       super.accept(paramPsiElementVisitor);
/* 64:   */     }
/* 65:   */   }
/* 66:   */   
/* 67:   */   public void accept(RegExpElementVisitor paramRegExpElementVisitor)
/* 68:   */   {
/* 69:64 */     paramRegExpElementVisitor.visitRegExpElement(this);
/* 70:   */   }
/* 71:   */   
/* 72:   */   public PsiElement replace(@NotNull PsiElement paramPsiElement)
/* 73:   */     throws IncorrectOperationException
/* 74:   */   {
/* 75:68 */     if (paramPsiElement == null) {
/* 76:68 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/intellij/lang/regexp/psi/impl/RegExpElementImpl", "replace" }));
/* 77:   */     }
/* 78:68 */     ASTNode localASTNode = paramPsiElement.getNode();
/* 79:69 */     assert (localASTNode != null);
/* 80:70 */     getNode().getTreeParent().replaceChild(getNode(), localASTNode);
/* 81:71 */     return paramPsiElement;
/* 82:   */   }
/* 83:   */   
/* 84:   */   public void delete()
/* 85:   */     throws IncorrectOperationException
/* 86:   */   {
/* 87:75 */     getNode().getTreeParent().removeChild(getNode());
/* 88:   */   }
/* 89:   */   
/* 90:   */   public final String getUnescapedText()
/* 91:   */   {
/* 92:79 */     if (InjectedLanguageUtil.isInInjectedLanguagePrefixSuffix(this)) {
/* 93:81 */       return getText();
/* 94:   */     }
/* 95:83 */     return InjectedLanguageManager.getInstance(getProject()).getUnescapedText(this);
/* 96:   */   }
/* 97:   */   
/* 98:   */   public static boolean isLiteralExpression(@Nullable PsiElement paramPsiElement)
/* 99:   */   {
/* :0:87 */     if (paramPsiElement == null) {
/* :1:87 */       return false;
/* :2:   */     }
/* :3:88 */     ASTNode localASTNode = paramPsiElement.getNode();
/* :4:89 */     if (localASTNode == null) {
/* :5:90 */       return false;
/* :6:   */     }
/* :7:92 */     IElementType localIElementType = localASTNode.getElementType();
/* :8:93 */     ParserDefinition localParserDefinition = (ParserDefinition)LanguageParserDefinitions.INSTANCE.forLanguage(paramPsiElement.getLanguage());
/* :9:94 */     return localParserDefinition.getStringLiteralElements().contains(localIElementType);
/* ;0:   */   }
/* ;1:   */ }



/* Location:           E:\idea\

 * Qualified Name:     org.intellij.lang.regexp.psi.impl.RegExpElementImpl

 * JD-Core Version:    0.7.0.1

 */